﻿using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AB.Common
{
    /// <summary>
    /// AB.Common调试信息配置
    /// </summary>
    public class ABCommonDebug
    {
        /// <summary>
        /// 调试信息输出方式 0：Debug 1：ABLog 2：都输出
        /// </summary>
        public static int OutputType = 0;
        /// <summary>
        /// 输出信息
        /// </summary>
        /// <param name="content"></param>
        public static void WriteLine(params object[] content)
        {
            foreach (var item in content)
            {
                Debug.WriteLineIf(OutputType == 0 || OutputType == 2,item);
            }
            ABLog.DebugIf(OutputType == 1|| OutputType == 2,content);
        }
        /// <summary>
        /// 如果条件为 true，则输出信息
        /// </summary>
        /// <param name="condition"></param>
        /// <param name="content"></param>
        public static bool WriteLineIf(bool condition,params object[] content)
        {
            if (condition)
            {
                WriteLine(content);
            }
            return condition;
        }
    }
}
